import React,{useEffect} from 'react'
import { reduxTest } from '../../redux/action'
import ReduxTest from './ReduxTest'
import { useDispatch, useSelector } from 'react-redux'

export default function ComTest() {
   const dispatch = useDispatch()
   const testNum = useSelector((state:any) => state.testNum)
   const btn_rudux=()=>{
        dispatch(reduxTest(testNum))
    }
    useEffect(() => {
        dispatch(reduxTest(0))
    }, [])
    return (
        <>
            <button onClick={btn_rudux}>点击加一(redux测试)</button>
          
            <ReduxTest ></ReduxTest>
  
        </>
    )
}
